# TiKV config template
#  Human-readable big numbers:
#   File size(based on byte): KB, MB, GB, TB, PB
#    e.g.: 1_048_576 = "1MB"
#   Time(based on ms): ms, s, m, h
#    e.g.: 78_000 = "1.3m"

{% for item, value in tikv_conf.global | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[readpool.storage]
{% for item, value in tikv_conf.readpool.storage | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[readpool.coprocessor]
{% for item, value in tikv_conf.readpool.coprocessor | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[server]
{% for item, value in tikv_conf.server | dictsort -%}
{% if item == "labels" %}
{{ item }} = {{ value | tikv_server_labels_format }}
{% else %}
{{ item }} = {{ value | to_json }}
{% endif %}
{% endfor %}

[storage]
{% for item, value in tikv_conf.storage | dictsort -%}
{% if value is not mapping -%}
{{ item }} = {{ value | to_json }}
{% else %}

[storage.{{ item }}]
{% for sub_item, sub_value in value | dictsort -%}
{{ sub_item }} = {{ sub_value | to_json }}
{% endfor %}
{% endif %}
{% endfor %}

[pd]
# This section will be overwritten by command line parameters
{% for item, value in tikv_conf.pd | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[metric]

[raftstore]
{% for item, value in tikv_conf.raftstore | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[coprocessor]
{% for item, value in tikv_conf.coprocessor | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[rocksdb]
{% for item, value in tikv_conf.rocksdb | dictsort_by_value_type -%}
{% if value is not mapping -%}
{{ item }} = {{ value | to_json}}
{% else %}

[rocksdb.{{ item }}]
{% for sub_item, sub_value in value | dictsort -%}
{% if sub_value is not mapping -%}
{{ sub_item }} = {{ sub_value | to_json }}
{% else %}

[rocksdb.{{ item }}.{{sub_item}}]
{% for sub_sub_item, sub_sub_value in sub_value | dictsort -%}
{{ sub_sub_item }} = {{ sub_sub_value | to_json }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}

[raftdb]
{% for item, value in tikv_conf.raftdb | dictsort_by_value_type -%}
{% if value is not mapping -%}
{{ item }} = {{ value | to_json}}
{% else %}

[raftdb.{{ item }}]
{% for sub_item, sub_value in value | dictsort -%}
{{ sub_item }} = {{ sub_value | to_json }}
{% endfor %}
{% endif %}
{% endfor %}

[security]
{% for item, value in tikv_conf.security | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}

[import]
{% for item, value in tikv_conf.import | dictsort -%}
{{ item }} = {{ value | to_json }}
{% endfor %}
